<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html; charset=utf-8" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>平台管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="/css/plat-style.css" media="all">
    <style>
        thead tr th {
            text-align: center !important;
        }

        tr td {
            text-align: center !important;
        }

        .editThis, .updateThis, .updatePassword, .guarantee {
            border: 1px solid #fff;
        }
    </style>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <div class="test-table-reload-btn layui-col-sm-offset10" style="margin-bottom: 10px;">
                        <button class="layui-btn layui-btn-warm editThis" type="button" style="margin-left: 10px" data-id="">新增仓库</button>
                    </div>
                    <%-- 数据展示 --%>
                    <table class="layui-table">
                        <thead>
                            <tr>
                                <th>编号</th>
                                <th>仓库名称</th>
                                <th>仓库地址</th>
                                <th>仓库状态</th>
                                <th>创建时间</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            <c:forEach items="${list}" var="l">
                                <tr>
                                    <td>${l.id}</td>
                                    <td>${l.name}</td>
                                    <td>${l.nameExt} ${l.addressDetail}</td>
                                    <td>
                                        <c:if test="${l.status==1}">有效</c:if>
                                        <c:if test="${l.status==0}">无效</c:if>
                                    </td>
                                    <td><fmt:formatDate value="${l.createtime}" pattern="yyyy-MM-dd HH:mm"></fmt:formatDate> </td>
                                    <td>
                                        <button data-id="${l.id}" type="button" class="layui-btn layui-btn-sm editThis">编辑</button>
                                    </td>
                                </tr>
                            </c:forEach>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form'], function () {
        var $ = layui.$, layer = layui.layer, form = layui.form, element = layui.element;
        form.render('select');
        element.render();

        var active = {
            editThis:function(id){
                layer.open({
                    title:'新增/编辑仓库信息',
                    type: 2,
                    area: ['700px', '500px'],
                    content: '/warehouse/warehouseEdit?id='+id
                });
            }
        };

        $(".editThis").on('click',function () {
            var type = 'editThis';
            var id = $(this).data('id');
            active[type] && active[type].call(this,id);
        })
    });
</script>
</body>
</html>